import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// lzr
import axios from 'axios'
Vue.prototype.$axios = axios

Vue.use(ElementUI)

Vue.config.productionTip = false

Vue.filter('dateFormat', dataStr => {
  var time = new Date(dataStr)

  function timeAdd0(str) {
    if (str < 10) {
      str = '0' + str
    }
    return str
  }
  var y = time.getFullYear()
  var m = time.getMonth() + 1
  var d = time.getDate()
  var h = time.getHours()
  var mm = time.getMinutes()
  var s = time.getSeconds()
  return (
    y +
    '-' +
    timeAdd0(m) +
    '-' +
    timeAdd0(d) +
    ' ' +
    timeAdd0(h) +
    ':' +
    timeAdd0(mm) +
    ':' +
    timeAdd0(s)
  )
})

Vue.prototype.$lod = {
  background: 'rgba(0, 0, 0, 0.8)',
  text: '加载中'
}

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
